package com.example.testrssparser;

import java.net.MalformedURLException;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import android.util.Log;

public class Message implements Comparable<Message>{
    static SimpleDateFormat FORMATTER = 
        new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z");
    private String title;
    private String autor;
    private URL link;
    private String description;
    private Date date;

    public void setLink(URL link) {
    	this.link = link;
    }
    
    public Date getDate() {
        return this.date;
    }

    public void setDate(Date date) {
    	this.date = date;
    }
    
    public String getTitle() {
		return title;
	}

    public void setTitle(String title) {
		this.title = title;
	}
    
    public String getAutor() {
		return autor;
	}

    public void setAutor(String autor) {
		this.autor = autor;
	}

    public String getDescription() {
		return description;
	}

    public void setDescription(String description) {
		this.description = description;
	}

	@Override
    public String toString() {
             return title;
    }

    @Override
    public int hashCode() {
             return hashCode();
    }
    
    @Override
    public boolean equals(Object obj) {
             return this.equals(obj);
    }
    
    public int compareTo(Message another) {
        if (another == null) return 1;
        return another.getDate().compareTo(getDate());
    }
}